import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

class Person{
	id:number;
	name:string;
	wugong:string[];
}
@ccclass('jsontest')
export class jsontest extends Component {
    start() {
		let person = new Person
		person.id=10
		person.name = 'llx'
		person.wugong=['降龙十八掌','九阴白骨爪']
		// 对象->字符串
		let json = JSON.stringify(person)
		console.debug(person)
		// 对象<-字符串
		let person2 = Object.assign(new Person,JSON.parse(json))
		console.debug(person2)
    }

    update(deltaTime: number) {
        
    }
}

